# 引入Adafruit_DHT
import Adafruit_DHT
import time

# 定义sensor型号为DHT22
sensor = Adafruit_DHT.DHT22

pin = 17


# 循环
def DHT22():
    # 读取温湿度数据到temp和hu两个变量中
    hu, temp = Adafruit_DHT.read_retry(sensor, pin)
    # 打印出结果
    temperature = int(float('%-3.1f' % temp))
    humidity = int(float('%-3.1f' % hu))
    # 循环延迟设为3秒
    return temperature, humidity


def DHT22_1():
    # 读取温湿度数据到temp和hu两个变量中
    hu, temp = Adafruit_DHT.read_retry(sensor, 18)
    # 打印出结果
    temperature = int(float('%-3.1f' % temp))
    humidity = int(float('%-3.1f' % hu))
    # 循环延迟设为3秒
    return temperature, humidity
